import win32gui
import win32api


def print_hand(hwnd):
    title = win32gui.GetWindowText(hwnd)
    name = win32gui.GetClassName(hwnd)
    re = win32gui.GetWindowRect(hwnd)
    print(hwnd)
    print(title)
    print(name)
    print(re)
    print()


def get_child_windows(parent):
    '''
    获得parent的所有子窗口句柄
     返回子窗口句柄列表
     '''
    if not parent:
        return
    hwndChildList = []
    win32gui.EnumChildWindows(parent, lambda hwnd, param: param.append(hwnd), hwndChildList)
    return hwndChildList


if __name__ == '__main__':
    hwndChildList = get_child_windows(0x00090FC0)
    for item in hwndChildList:
        print_hand(item)